//
//  UIColor+Ext.m
//  BaseTdkc
//
//  Created by DavidHuang on 16/7/1.
//  Copyright © 2016年 黄栋炜. All rights reserved.
//

#import "UIColor+Ext.h"
static NSString *const COLOR_DEVILELINE = @"#c0c0c0";
static NSString *const COLOR_CLICK_BLUE = @"#05A5DF";

static NSString *const COLOR_LIGHT_BLUE = @"#00bbfb";
static NSString *const COLOR_BACKGROUND = @"#f5f5f5";
static NSString *const COLOR_ONE_TEXT = @"#3c3c3c";
static NSString *const COLOR_TWO_TEXT = @"#a0a0a0";
static NSString *const COLOR_THREE_TEXT = @"#c0c0c0";
static NSString *const COLOR_TIPS_TEXT = @"#ff5023";
static NSString *const COLOR_TOUCH_INSIDE = @"#05A5DF";
static NSString *const COLOR_LIGHT_DEVILELINE = @"#D8D8D8";

static NSString *const COLOR_FAN_ORANGE = @"#FCC009";
static NSString *const COLOR_FAN_GREEN = @"#87C170";
static NSString *const COLOR_FAN_GRAY = @"#ABABAB";
static NSString *const COLOR_FAN_PINK = @"#FF7676";
static NSString *const COLOR_ORANGE_YELLOW = @"fca32e";

@implementation UIColor (Ext)
+ (UIColor *)colorWithR:(CGFloat)red G:(CGFloat)green B:(CGFloat)blue alpha:(CGFloat)alpha {
    return [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:alpha];
}
+ (UIColor *)colorWithR:(CGFloat)red G:(CGFloat)green B:(CGFloat)blue {
    return [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:1.0];
}
+ (UIColor *)colorWithHexString:(NSString *)color alpha:(CGFloat)alpha {
    NSString *cString = [[color stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
    if ([cString length] < 6)
    {
        return [UIColor clearColor];
    }
    if ([cString hasPrefix:@"0X"])
    {
        cString = [cString substringFromIndex:2];
    }
    if ([cString hasPrefix:@"#"])
    {
        cString = [cString substringFromIndex:1];
    }
    if ([cString length] != 6)
    {
        return [UIColor clearColor];
    }
    
    NSRange range;
    range.location = 0;
    range.length = 2;
    //r
    NSString *rString = [cString substringWithRange:range];
    //g
    range.location = 2;
    NSString *gString = [cString substringWithRange:range];
    //b
    range.location = 4;
    NSString *bString = [cString substringWithRange:range];
    
    unsigned int r, g, b;
    [[NSScanner scannerWithString:rString] scanHexInt:&r];
    [[NSScanner scannerWithString:gString] scanHexInt:&g];
    [[NSScanner scannerWithString:bString] scanHexInt:&b];
    return [UIColor colorWithRed:((float)r / 255.0f) green:((float)g / 255.0f) blue:((float)b / 255.0f) alpha:alpha];
}

+ (UIColor *)colorWithHexString:(NSString *)color
{
    return [self colorWithHexString:color alpha:1.0f];
}

+ (UIColor *)colorofLoseEBlueColor{
    return [self colorWithHexString:COLOR_LIGHT_BLUE];
}
+ (UIColor *)colorofClickBlueColor{
    return [self colorWithHexString:COLOR_CLICK_BLUE];
}

+ (UIColor *)colorOfDevilelineColor {
    return  [self colorWithHexString:COLOR_DEVILELINE];
}
+ (UIColor *)colorofOrangeYellowColor {
    return  [self colorWithHexString:COLOR_ORANGE_YELLOW];
}
+ (UIColor *)colorOfLightBlueColor {
    return [self colorWithHexString:COLOR_LIGHT_BLUE];
}
+ (UIColor *)colorOfBackgroudColor {
    return [self colorWithHexString:COLOR_BACKGROUND];
}
+ (UIColor *)colorOfMainColor {
    return [self colorWithHexString:COLOR_LIGHT_BLUE];
}
+ (UIColor *)colorOfOneTextColor {
    return [self colorWithHexString:COLOR_ONE_TEXT];
}
+ (UIColor *)colorOfTwoTextColor {
    return [self colorWithHexString:COLOR_TWO_TEXT];
}
+ (UIColor *)colorOfThreeTextColor {
    return [self colorWithHexString:COLOR_THREE_TEXT];
}
+ (UIColor *)colorOfTipsTextColor {
    return [self colorWithHexString:COLOR_TIPS_TEXT];
}
+ (UIColor *)colorOfTouchInside {
    return [self colorWithHexString:COLOR_TOUCH_INSIDE];
}

+ (UIColor *)colorOfLightDevileline {
    return [self colorWithHexString:COLOR_LIGHT_DEVILELINE];
}
+ (UIColor *)colorOfCakeInFanOrangeColor {
    return [self colorWithHexString:COLOR_FAN_ORANGE];
}
+ (UIColor *)colorOfCakeInFanGreenColor {
    return [self colorWithHexString:COLOR_FAN_GREEN];
}
+ (UIColor *)colorOfCakeInFanGrayColor {
    return [self colorWithHexString:COLOR_FAN_GRAY];
}
+ (UIColor *)colorOfCakeInFanPinkColor {
    return [self colorWithHexString:COLOR_FAN_PINK];
}
@end
